package com.deng.commons.utils;


import com.deng.commons.common.CodeType;
import com.wf.captcha.*;
import com.wf.captcha.base.Captcha;

/**
 * 验证码工具类
 */
public class CodeUtils {

    public static Captcha getCaptcha(CodeType codeType){

        Captcha captcha = null;
        switch (codeType){
            case SPEC:
                captcha = new SpecCaptcha(130, 48);
                break;
            case GIF:
                captcha = new GifCaptcha(130, 48);
                break;
            case CHINESE:
                captcha = new ChineseCaptcha(130, 48);
                break;
            case CHINESE_GIF:
                captcha = new ChineseGifCaptcha(130, 48);
                break;
            case ARITHMETIC:
                captcha = new ArithmeticCaptcha(110, 48);
                captcha.setLen(2);  // 几位数运算，默认是两位
                break;
        }
        return captcha;
    }

}
